<template>
  <div class="commonheader">
    <div class="header_icon">
      <i class="iconfont" @click="clickHandle">&#xe62a;</i>
    </div>
    <div class="header_pic">
      <img :src="imgUrl">
    </div>
    <div class="header_icon ">
      <router-link tag="div" to="/release" class="header_hid" v-show="isMain">
        <i class="iconfont">&#xe63a;</i><span>{{title}}</span>
      </router-link>
    </div>
    <HomeNav v-show="flag" :status="status"/>
  </div>
</template>
<script>
import HomeNav from "./home/HomeNav"
export default {
  name: 'CommonHeader',
  data() {
    return {
      imgUrl:require("../assets/images/logo.png"),
      flag:false,
      status:true
    }
  },
  methods:{
    clickHandle(event){
      this.flag=!this.flag
      if(localStorage.getItem('username')){
        this.status = false
      }else{
        this.status = true
      }
    }
  },
  components:{
    HomeNav
  },
  props:{
    homeNav:{
      type:Array,
      default:function(){
        return []
      }
    },
    title:{
      type: String
    },
    isMain:{
      type: Boolean
    }
  }
}

</script>
<style scoped>
.commonheader{
  width: 100%;
  display: flex;
  position: relative;
  font-size: 0.16rem;
  text-align: center;
  background-color: #fff;
  border-bottom:0.01rem solid #ededed;
}
.commonheader img{
  height: 0.6rem;
}
.commonheader i{
  font-size: 0.18rem;
  line-height: 0.6rem;
}
.commonheader .header_icon{
  color: #109d59;
  flex: 1;
}
.commonheader .header_pic{
  flex: 4;
}
.header_hid{
  /*display: none;*/
}

</style>
